<h1><?php echo Yii::t('view', 'Endpoints'); ?></h1>
<?php $this->widget('bootstrap.widgets.BootAlert'); ?>

<div align="right" style="margin-bottom: 3px">
<?php 
$this->widget('bootstrap.widgets.BootButton', array(
    'label' => Yii::t('view', 'Create'),
	'icon' => 'icon-plus icon-white',
	'type'=>'primary',
    'url' => array('/endpoint/create'),
));
?>
</div>

<table class="table table-striped table-bordered">
	  	<thead>
	    	<tr>
	    		<th><?php echo Endpoint::model()->getAttributeLabel('type'); ?></th>
	    		<th><?php echo Endpoint::model()->getAttributeLabel('name'); ?></th>
	      		<th><?php echo Endpoint::model()->getAttributeLabel('url'); ?></th>
	      		<th><?php echo Endpoint::model()->getAttributeLabel('folder'); ?></th>
	      		<th><?php echo Endpoint::model()->getAttributeLabel('user'); ?></th>
	      		<th><?php echo Endpoint::model()->getAttributeLabel('password'); ?></th>
	      		<th width="130px"><?php echo Yii::t('view', 'Actions'); ?></th>
	    	</tr>
	  	</thead>
	  	<tbody>
<?php 
if (isset($data)) {
	foreach ($data AS $d) {
		?><tr>
			<td>
				<?php echo $d->getTypeText(); ?>
			</td>
			<td>
				<?php echo $d->name; ?>
			</td>
			<td>
				<?php echo $d->url; ?>
			</td>
			<td>
				<?php echo $d->folder; ?>
			</td>
			<td>
				<?php echo $d->user; ?>
			</td>
			<td>
				<?php echo $d->password; ?>
			</td>
			<td>
				<?php 
					$this->widget('bootstrap.widgets.BootButton', array(
					    'type'=>'success', 
			      		'url' => array('update', 'id'=>$d->uuid),
					    'size'=>'mini', 
			      		'icon'=>'icon-pencil'
					)); 
				    
					?> <?php 
					if ($d->shared == '1') 
					{ 
						$icon = 'icon-eye-open';
					} 
					else 
					{ 
						$icon = 'icon-eye-close'; 
					}
					
					$disabled = false;
					$url = array('share', 'id' => $d->uuid);
					
					
					
					$this->widget('bootstrap.widgets.BootButton', array(
					    'icon'=> $icon,
					    'type'=>'danger', 
			      		'url' => $url,
					    'size'=>'mini', 
						'htmlOptions' => array('disabled' => $disabled)
					)); 
				?> 
			</td>
		</tr>
	<?php 
	}
} else {
	?>
	<tr>
		<td colspan="5">
			<?php echo Yii::t('view', 'No Endpoint created yet.'); ?>
		</td>
	</tr>
	
	<?php 
}
?>
</tbody>
</table>
